package weixintest;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/4/13 22:07
 */
class ParentClass2 {
    public int count() {
        return 0;
    }

    Object method() {
        return "aa";
    }

    <T extends ParentClass2> T getValue(T t) {
        System.out.println("parent");
        return t;
    }
}

public class ChildClass2 extends ParentClass2 {
    public static void main(String[] args) {
        ParentClass2 pc = new ChildClass2();
        pc.count();
        pc.method();
        pc.getValue(new ParentClass2());
    }

    //由于返回类型是基本类型，不能变，必须一致
    @Override
    public int count() {
        System.out.println("child");
        return super.count();
    }

    //访问权限增大,返回值是Object的子类String
    @Override
    public String method() {
        System.out.println("child");
        return "aa";
    }

    //重写泛型方法getValue
    @Override
    ChildClass2 getValue(ParentClass2 t) {
        System.out.println("child");
        return null;
    }
}
